import { PureComponent } from 'react'

function enhanceUserInfo(Cpn) {
  class NewComponent extends PureComponent {
    constructor(props) {
      super(props)
      this.state = {
        userInfo: {
          name: 'coderwhy',
          level: 99,
        },
      }
    }

    render() {
      return <Cpn {...this.state.userInfo} {...this.props} />
    }
  }

  return NewComponent
}

export default enhanceUserInfo
